import axios from 'axios'

export const httpRequest = (method, url, params = {}, type = "data") => {
    let headers = { 'Content-Type': 'application/json', }
    if (method == 'get' || type == "params") {
        console.log("params")
        return axios({
            method: method,
            url: url,
            headers: headers,
            params: params
        }).then(res => res.data);
    } else {
        return axios({
            method: method,
            url: url,
            headers: headers,
            data: params
        }).then(res => res.data);
    }

}